﻿using Microsoft.AspNetCore.Mvc.Filters;

namespace Farming.WebApi
{
    public class CustomException : IExceptionFilter
    {
        private readonly ILogger<CustomException> logger;

        public CustomException(ILogger<CustomException> logger)
        {
            this.logger = logger;
        }

        public void OnException(ExceptionContext context)
        {
            logger.LogError("【全局异常】" + context.Exception);
        }
    }
}
